<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use common\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $model backend\models\MotionGroup */
$this->title = '身份证审核';
$this->params['breadcrumbs'][] = ['label' => '身份证', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h1 class="box-title"><?= Html::encode($this->title) ?></h1>
            </div>
            <div class="box-body table-responsive">
                <div style="margin-bottom:10px;">
                    <?php
                    switch ($model->status) {
                        case 0:
                            echo Html::tag('h3', '!审核未通过!');
                            break;
                        case 1:
                            echo Html::a('通过', ['tf-futures/identity/update', 'id' => $model->id, 'status' => 2], [
                                'class' => 'btn btn-primary',
                            ]);
                            echo ' ';
                            echo Html::a('不通过', ['tf-futures/identity/update', 'id' => $model->id, 'status' => 0], [
                                'class' => 'btn btn-danger',
                            ]);
                            break;
                        case 2:
                            echo Html::tag('h3', '审核通过');
                            break;
                    }
                    ?>
                </div>
                <?= DetailView::widget([
                    'model' => $model,
                    'attributes' => [
                        [
                            'attribute' => 'user_id',
                            'label' => '真实姓名',
                            'format' => 'raw',
                            'value' => function ($model) {
                                if (empty($model->real_name)) {
                                    //用户未填写真实姓名,请填写后再提交
                                    return Html::tag('p', '(未填写)');
                                }

                                return Html::tag('p', $model->real_name);
                            },
                        ],
                        [
                            'attribute' => 'bank_code',
                            'label' => '银行卡号',
                            'format' => 'raw',
                            'value' => function ($model) {
                                return Html::tag('p', $model->bank->bank_code);
                            },
                        ],
                        [
                            'attribute' => 'bank_name',
                            'label' => '银行名称',
                            'format' => 'raw',
                            'value' => function ($model) {
                                return Html::tag('p', $model->bank->bank_name);
                            },
                        ],
                        [
                            'attribute' => 'child_name',
                            'label' => '支行名称',
                            'format' => 'raw',
                            'value' => function ($model) {
                                return Html::tag('p', $model->bank->child_name);
                            },
                        ],
                        'code',
                        [
                            'attribute' => 'status',
                            'value' => function ($model) {
                                switch ($model->status) {
                                    case 0:
                                        $a = '未通过';
                                        break;
                                    case 1:
                                        $a = '审核中';
                                        break;
                                    case 2:
                                        $a = '审核通过';
                                        break;
                                }

                                return $a;
                            },
                        ],
//                        'created_at:date',
                        [
                            'attribute' => 'created_at',
                            'value' => function ($model) {
                                return date('Y-m-d H:i:s', $model->created_at);
                            },
                        ],
                    ],
                ]) ?>
            </div>
        </div>
    </div>
</div>


